package controller.v2;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import model.LogOrder;
import model.MemberVO;
import model.OrderTimer;
import model.OrderVO;
import model.RefuseReasonVO;
import service.v2.MemberService;
import service.v2.OrderCancelService;
import service.v2.OrderService;
import service.v2.SplitService;
import util.PackageUtil;
import util.PropertieUtil;

@Controller
@RequestMapping("/v2/orderCancel")
public class OrderCancelController {
	
	@Autowired
	private OrderService orderService;

	/**
	 *  获取退款理由
	 * @param token
	 * @param member_id
	 * @param memberVO
	 * @return
	 * @throws Exception
	 */
	@ResponseBody
	@RequestMapping(value="/getRefuseReason",method=RequestMethod.GET) 
	public Object getRefuseReason(@RequestHeader (value="AUTHORIZATION", required=false) String token,@RequestHeader (value="SECRET", required=false)String member_id,
			MemberVO memberVO) throws Exception{
		List<RefuseReasonVO> reasonList = orderService.getAllRefuseMsg(PropertieUtil.loadPropertie("return_reason"));
		return PackageUtil.packageParams(200,"successs",reasonList,"");
	}
		
	/**
	 *  获取退款理由
	 * @param token
	 * @param member_id
	 * @param memberVO
	 * @return
	 * @throws Exception
	 */
	@ResponseBody
	@RequestMapping(value="/getRefuseReasonEn",method=RequestMethod.GET) 
	public Object getRefuseReasonEn() throws Exception{
		List<RefuseReasonVO> reasonList = orderService.getAllRefuseMsg(PropertieUtil.loadPropertie("return_reason_en"));
		return PackageUtil.packageParams(200,"successs",reasonList,"");
	}
	
	
	/**
	 *  获取退款理由
	 * @param token
	 * @param member_id
	 * @param memberVO
	 * @return
	 * @throws Exception
	 */
	@ResponseBody
	@RequestMapping(value="/getBackReasonEn",method=RequestMethod.GET) 
	public Object getBackReasonEn() throws Exception{
		List<RefuseReasonVO> reasonList = orderService.getAllRefuseMsg(PropertieUtil.loadPropertie("back_reason_en"));
		return PackageUtil.packageParams(200,"successs",reasonList,"");
	}
	
}
